export default class DataResponse {
    status: string;
    datapacks: Datapack[] | null;
    constructor() {
        this.status = "failed";
        this.datapacks = null
    }
}

export class Datapack {
    get time(): string {
        if (this._time != null) {
            return this._time.toLocaleString();
        } else {
            return ""
        }
    }

    set time(value: string) {
        this._time = null;
    }

    private _time: Date | null;
    public deviceNumber: string;
    public data: Data[];
    constructor() {
        this._time = null;
        this.deviceNumber = "";
        this.data = [];
    }
}

export class Data {
    get time(): string {
        if (this._time != null) {
            return this._time.toLocaleString();
        } else {
            return ""
        }
    }

    set time(value: string) {
        this._time = new Date(value);
    }

    private _time: Date | null;
    public name: string | null;
    public unit: string | null;
    public value: number | null;
    public minValue: number | null;
    public maxValue: number | null;

    constructor() {
        this._time = null;
        this.name = null;
        this.unit = null;
        this.value = null;
        this.minValue = null;
        this.maxValue = null;
    }
}